//引入express
const express = require('express')
//创建服务器
const app = express()
app.get('/foods', (request, response) => {
  const foods = [
    {
      id: '01',
      name: '猪脚饭',
      price: 28
    },
    {
      id: '02',
      name: '大汉堡',
      age: 28
    },
    {
      id: '03',
      name: '小龙虾',
      age: 66
    }
  ]
  response.send(foods)
})
//监听
app.listen(5001, (err) => {
  if (!err) console.log('服务器启动成功，请求的地址为:http://localhost:5001/foods')
})